<?php
//if not a real page (nobody called us here, just user trying to hack
if ((!isset($_SESSION['realpage']))
 || ($_SESSION['realpage'] == false))
 {
 	require './hack.php';
 	die(" ");
 }

error_reporting(E_ALL);


if (0 > version_compare(PHP_VERSION, '5')) {
	die('This file was generated for PHP 5');
}

require_once('class.User.php');


class Group
{
	
	// --- ATTRIBUTES ---

	
	public $timestamp = null;
	
	public $Visible = null;
	
	public $gid = null;
	
	public $name = null;
	
	public $desc = null;

	public $id = null;
	
	public $friendsgroup = null;
	
	public $relation = null; // types - O= owner, m= member, p= member pending authorization, d- denied.
	
	// --- OPERATIONS ---
	public static function factorGroup($sqlArr)
	{
		$obj = new Group();     
		$flags = ENT_COMPAT | ENT_QUOTES ;

		$obj->gid    		= $sqlArr['gid'];	  	 	//meta
		if(isset($sqlArr['relation']))
		{
			$obj->relation 		= $sqlArr['relation']; 		//meta
		}
		else
		{
			$obj->relation 		= "U";
		}
		$obj->friendsgroup 	= $sqlArr['friendsgroup'];  //meta
		$obj->Visible		= $sqlArr['visibility'];
		$obj->name	 		= htmlspecialchars ( $sqlArr['name'],$flags ,'UTF-8');
//		$obj->desc	 		= htmlspecialchars ( $sqlArr['description'],$flags ,'UTF-8');	

		$obj->desc = str_replace("[dropline]", '<br>', htmlspecialchars ( $sqlArr['description'],$flags ,'UTF-8'));
		
		return  $obj;	
	}
} /* end of class Group */

?>